﻿'Params:
'	artist (Required (unless mbid)] : The artist name
'	mbid (Optional) : The musicbrainz id for the artist
'	lang (Optional) : The language to return the biography in, expressed as an ISO 639 alpha-2 code.
'	autocorrect[0|1] (Optional) : Transform misspelled artist names into correct artist names, returning the correct version instead. The corrected artist name will be returned in the response.
'	username (Optional) : The username for the context of the request. If supplied, the user's playcount for this artist is included in the response.
'	api_key (Required) : A Last.fm API key.
'
'Auth:
'	This service does not require authentication. 
'
Public Structure AlbumGetInfoResponse
	Dim album As Album

End Structure

Public Class AlbumGetInfo
	Inherits BaseRequest
	Dim artist As String = ""
	Dim album As String = ""
	Dim mbid As String = ""
	Dim lang As String = ""
	Dim autocorrect As String = ""

	Public xmlresponse As XDocument = Nothing

	Public Sub New(ByVal artist As String, ByVal album As String, ByVal mbid As String, ByVal lang As String, ByVal autocorrect As String)
		Me.artist = artist
		Me.album = album
		Me.mbid = mbid
		Me.lang = lang
		Me.autocorrect = autocorrect
	End Sub

	Public Sub sendRequest()
		InitializeMembers("album.getInfo")

		AddMember("artist", artist, String.IsNullOrEmpty(mbid))
		AddMember("album", album, String.IsNullOrEmpty(mbid))
		AddMember("mbid", mbid, False)
		AddMember("lang", lang, False)
		AddMember("autocorrect", autocorrect, False)
		AddMember("username", My.Settings.user_name, False)
		AddMember("api_key", My.Settings.api_key, False)

		xmlresponse = sendPOSTResponse()
	End Sub

	Public Function getResponse() As AlbumGetInfoResponse
		Dim response As AlbumGetInfoResponse = Nothing

		Try
			response.album = New Album(xmlresponse.<lfm>.<album>.First)
		Catch ex As Exception

		End Try
		Return response
	End Function

End Class

